﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using G15_Agent.Models;
using G15_Agent.BUS;

namespace G15_Agent.Helpers.ServiceHelpers
{
    public class Service
    {
        protected AgentContext DatabaseSQL = new AgentContext();
        protected string _mServiceID;
        protected bool isLogin = false;
        protected string _mDefaultUsername;
        protected string _mDefaultPassword;

        protected string DefaultPassword
        {
            get { return _mDefaultPassword; }
            set { _mDefaultPassword = value; }
        }

        protected string DefaultUsername
        {
          get { return _mDefaultUsername; }
          set { _mDefaultUsername = value; }
        }

        public string ServiceID
        {
            get { return _mServiceID; }
            set { _mServiceID = value; }
        }

        virtual protected bool CallSpecificServiceLogin(string username, string password)
        {
            return false;
        }

        public bool Login()
        {
            //DanhSachNCC data = DatabaseSQL.DanhSachNCCs.Find(ServiceID);
            DanhSachNCC data = null;

            string username = DefaultUsername;
            string password = DefaultPassword;
            if (data != null)
            {
                username = data.Username;
                password = data.Pass;
            }
            bool result = false;

            result = this.CallSpecificServiceLogin(username, password);
            isLogin = result;

            return result;
        }        
    }
}